//
//  BFZDataModel.m
//  QuickCure
//
//  Created by 小灰灰 on 16/9/14.
//  Copyright © 2016年 haoge. All rights reserved.
//

#import "BFZDataModel.h"
#import "NetWorkDefine.h"
#import "NetWorkTool.h"

@implementation BFZDataModel
+(instancetype)dataModelWithDic:(NSDictionary *)dic
{
    BFZDataModel *dataModel =[[BFZDataModel alloc] init];
    [dataModel setValuesForKeysWithDictionary:dic];
    return dataModel;
}
-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}
+(void)dataListWithSuccessBlock:(void(^)(NSArray *dataArr))successBlock errorBlock:(void(^)())errorBlock
{
    NSString *urlString = kComplicationListUrl;
    NSDictionary *paramDic = @{@"page":@1,@"page_size":@15,@"ci2_id":@3
                               };
    
    [[NetWorkTool shareManager] POST_RequestWithUrlString:urlString parmas:paramDic successBloock:^(id responseObject) {
        NSMutableArray *muArr =[NSMutableArray array];
        NSArray *dataArr = responseObject[@"data"];
        for (NSDictionary *dataDic in dataArr) {
            BFZDataModel *dataModel =[BFZDataModel dataModelWithDic:dataDic];
            
                [muArr addObject:dataModel];
        }
        if(successBlock)
        {
            successBlock(muArr.copy);
        }
        
    } failureBlock:^(NSError *error) {
        
        NSLog(@"error = %@",error);
    }];
    
}

@end
